/*
               File: type_SdtSDTRespostas_SDTRespostasItem
        Description: SDTRespostas
             Author: GeneXus C# Generator version 10_2_5-78484
       Generated on: 6/6/2014 9:53:21.61
       Program type: Callable routine
          Main DBMS: sqlserver
*/
using System;
using System.Collections;
using GeneXus.Utils;
using GeneXus.Resources;
using GeneXus.Application;
using GeneXus.Metadata;
using GeneXus.Data;
using GeneXus.Data.ADO;
using GeneXus.Data.NTier;
using GeneXus.Data.NTier.ADO;
using System.Runtime.Remoting;
using GeneXus.XML;
using GeneXus.Search;
using GeneXus.Encryption;
using GeneXus.Http.Client;
using System.Reflection;
using System.Xml.Serialization;
using System.Data.SqlTypes;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace GeneXus.Programs {
   [XmlSerializerFormat]
   [XmlRoot(ElementName = "SDTRespostas.SDTRespostasItem" )]
   [XmlType(TypeName =  "SDTRespostas.SDTRespostasItem" , Namespace = "DeMolay" )]
   [Serializable]
   public class SdtSDTRespostas_SDTRespostasItem : GxUserType
   {
      public SdtSDTRespostas_SDTRespostasItem( )
      {
         constructorCallingAssembly = Assembly.GetCallingAssembly();
         initialize();
      }

      public SdtSDTRespostas_SDTRespostasItem( IGxContext context )
      {
         this.context = context;
         constructorCallingAssembly = Assembly.GetCallingAssembly();
         initialize();
      }

      public override String ToXml( bool includeHeader ,
                                    bool includeState ,
                                    String name ,
                                    String sNameSpace )
      {
         String s ;
         XmlSerializer xmls ;
         xmls = new XmlSerializer(this.GetType(), sNameSpace);
         System.IO.MemoryStream stream = new System.IO.MemoryStream();
         System.Xml.XmlWriter xmlw = System.Xml.XmlWriter.Create(stream, new System.Xml.XmlWriterSettings() { OmitXmlDeclaration = !includeHeader});
         XmlSerializerNamespaces xmlns = new XmlSerializerNamespaces();
         xmlns.Add(String.Empty, sNameSpace);
         xmls.Serialize( xmlw, this, xmlns);
         stream.Seek(0L, System.IO.SeekOrigin.Begin);
         System.IO.StreamReader sr = new System.IO.StreamReader(stream);
         s = sr.ReadToEnd();
         stream.Close();
         return s ;
      }

      public override void FromXml( String s ,
                                    String name )
      {
         SdtSDTRespostas_SDTRespostasItem deserialized ;
         if (s.Trim().Length == 0)
            return;
         XmlSerializer xmls = new XmlSerializer(this.GetType(),  "DeMolay" );
         System.IO.StringReader sr = new System.IO.StringReader(s);
         deserialized = (SdtSDTRespostas_SDTRespostasItem)(xmls.Deserialize( sr)) ;
         sr.Close();
         SdtSDTRespostas_SDTRespostasItem obj ;
         obj = this;
         obj.gxTpr_Opcoesenqueteid = deserialized.gxTpr_Opcoesenqueteid;
         obj.gxTpr_Opcoesenquetetitulo = deserialized.gxTpr_Opcoesenquetetitulo;
         return  ;
      }

      public override short readxml( GXXMLReader oReader ,
                                     String sName )
      {
         short GXSoapError = 1 ;
         sTagName = oReader.Name;
         if ( oReader.IsSimple == 0 )
         {
            GXSoapError = oReader.Read();
            nOutParmCount = 0;
            while ( ( ( StringUtil.StrCmp(oReader.Name, sTagName) != 0 ) || ( oReader.NodeType == 1 ) ) && ( GXSoapError > 0 ) )
            {
               readOk = 0;
               if ( StringUtil.StrCmp2( oReader.LocalName, "OpcoesEnqueteId") )
               {
                  gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid = (short)(NumberUtil.Val( oReader.Value, "."));
                  if ( GXSoapError > 0 )
                  {
                     readOk = 1;
                  }
                  GXSoapError = oReader.Read();
               }
               if ( StringUtil.StrCmp2( oReader.LocalName, "OpcoesEnqueteTitulo") )
               {
                  gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo = oReader.Value;
                  if ( GXSoapError > 0 )
                  {
                     readOk = 1;
                  }
                  GXSoapError = oReader.Read();
               }
               nOutParmCount = (short)(nOutParmCount+1);
               if ( readOk == 0 )
               {
                  context.sSOAPErrMsg = context.sSOAPErrMsg + "Error reading " + sTagName + StringUtil.NewLine( );
                  GXSoapError = (short)(nOutParmCount*-1);
               }
            }
         }
         return GXSoapError ;
      }

      public override void writexml( GXXMLWriter oWriter ,
                                     String sName ,
                                     String sNameSpace )
      {
         writexml(oWriter, sName, sNameSpace, true);
         return  ;
      }

      public override void writexml( GXXMLWriter oWriter ,
                                     String sName ,
                                     String sNameSpace ,
                                     bool sIncludeState )
      {
         if ( String.IsNullOrEmpty(StringUtil.RTrim( sName)) )
         {
            sName = "SDTRespostas.SDTRespostasItem";
         }
         if ( String.IsNullOrEmpty(StringUtil.RTrim( sNameSpace)) )
         {
            sNameSpace = "DeMolay";
         }
         oWriter.WriteStartElement(sName);
         if ( StringUtil.StrCmp(StringUtil.Left( sNameSpace, 10), "[*:nosend]") != 0 )
         {
            oWriter.WriteAttribute("xmlns", sNameSpace);
         }
         else
         {
            sNameSpace = StringUtil.Right( sNameSpace, (short)(StringUtil.Len( sNameSpace)-10));
         }
         oWriter.WriteElement("OpcoesEnqueteId", StringUtil.Trim( StringUtil.Str( (decimal)(gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid), 4, 0)));
         if ( StringUtil.StrCmp(sNameSpace, "DeMolay") != 0 )
         {
            oWriter.WriteAttribute("xmlns", "DeMolay");
         }
         oWriter.WriteElement("OpcoesEnqueteTitulo", StringUtil.RTrim( gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo));
         if ( StringUtil.StrCmp(sNameSpace, "DeMolay") != 0 )
         {
            oWriter.WriteAttribute("xmlns", "DeMolay");
         }
         oWriter.WriteEndElement();
         return  ;
      }

      public override void ToJSON( )
      {
         ToJSON( true) ;
         return  ;
      }

      public override void ToJSON( bool includeState )
      {
         AddObjectProperty("OpcoesEnqueteId", (Object)(gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid), false);
         AddObjectProperty("OpcoesEnqueteTitulo", (Object)(gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo), false);
         return  ;
      }

      [  SoapElement( ElementName = "OpcoesEnqueteId" )]
      [  XmlElement( ElementName = "OpcoesEnqueteId"   )]
      public short gxTpr_Opcoesenqueteid
      {
         get {
            return gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid ;
         }

         set {
            gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid = (short)(value);
         }

      }

      public void gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid_SetNull( )
      {
         gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid = 0;
         return  ;
      }

      public bool gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid_IsNull( )
      {
         return false ;
      }

      [  SoapElement( ElementName = "OpcoesEnqueteTitulo" )]
      [  XmlElement( ElementName = "OpcoesEnqueteTitulo"   )]
      public String gxTpr_Opcoesenquetetitulo
      {
         get {
            return gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo ;
         }

         set {
            gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo = (String)(value);
         }

      }

      public void gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo_SetNull( )
      {
         gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo = "";
         return  ;
      }

      public bool gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo_IsNull( )
      {
         return false ;
      }

      public void initialize( )
      {
         gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo = "";
         sTagName = "";
         return  ;
      }

      protected short gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenqueteid ;
      protected short readOk ;
      protected short nOutParmCount ;
      protected String sTagName ;
      protected String gxTv_SdtSDTRespostas_SDTRespostasItem_Opcoesenquetetitulo ;
      protected Assembly constructorCallingAssembly ;
   }

   [DataContract(Name = "SDTRespostas.SDTRespostasItem", Namespace = "DeMolay")]
   public class SdtSDTRespostas_SDTRespostasItem_RESTInterface : GxGenericCollectionItem<SdtSDTRespostas_SDTRespostasItem>, System.Web.SessionState.IRequiresSessionState
   {
      public SdtSDTRespostas_SDTRespostasItem_RESTInterface( ) : base()
      {
      }

      public SdtSDTRespostas_SDTRespostasItem_RESTInterface( SdtSDTRespostas_SDTRespostasItem psdt ) : base(psdt)
      {
      }

      [DataMember( Name = "OpcoesEnqueteId" , Order = 0 )]
      public Nullable<short> gxTpr_Opcoesenqueteid
      {
         get {
            return sdt.gxTpr_Opcoesenqueteid ;
         }

         set {
            sdt.gxTpr_Opcoesenqueteid = (short)(value.HasValue ? value.Value : 0);
         }

      }

      [DataMember( Name = "OpcoesEnqueteTitulo" , Order = 1 )]
      public String gxTpr_Opcoesenquetetitulo
      {
         get {
            return sdt.gxTpr_Opcoesenquetetitulo ;
         }

         set {
            sdt.gxTpr_Opcoesenquetetitulo = (String)(value);
         }

      }

      public SdtSDTRespostas_SDTRespostasItem sdt
      {
         get {
            return (SdtSDTRespostas_SDTRespostasItem)Sdt ;
         }

         set {
            Sdt = value ;
         }

      }

      [OnDeserializing]
      void checkSdt( StreamingContext ctx )
      {
         if ( sdt == null )
         {
            sdt = new SdtSDTRespostas_SDTRespostasItem() ;
         }
      }

   }

}
